//
//  CarDetailsViewController.m
//  UcarTest
//
//  Created by 陈曦 on 16/1/14.
//  Copyright © 2016年 chenxi. All rights reserved.
//

#import "CarDetailsViewController.h"
#import "Define.h"
#import "SDCycleScrollView.h"
#import "PlaceAnOrderController.h"
#import "AFNetworking.h"
#import "NetRequestGroup.h"
#import "UIImageView+WebCache.h"
#import "Userinfo.h"
#import "LoginViewController.h"
#import "MBProgressHUD.h"
#import "GBTagListView.h"
#import "CarBasicView.h"
#import "CarConfigurationInformationView.h"

#define kHightOfImageView (kScreenWidth - 20) * 211 / 355

@interface CarDetailsViewController ()<SDCycleScrollViewDelegate>

@property (nonatomic, strong) UIScrollView *bgContainerView;//创建背景scroll视图

@property (nonatomic, strong) NSMutableArray *imageURLStrMArray;//网络图片地址集合

@property (nonatomic, strong) NSMutableArray *vehicleBrand;//品牌信息

@property (nonatomic, strong) NSMutableArray *vehicleBasic;//基本信息

@end

@implementation CarDetailsViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
 

    //背景色
    self.view.backgroundColor = [UIColor whiteColor];
    
    //导航条设置
    UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 200, 44)];
    titleLabel.backgroundColor = [UIColor clearColor];
    titleLabel.text = @"车辆详情";
    titleLabel.textColor = [UIColor whiteColor];
    titleLabel.textAlignment = NSTextAlignmentCenter;
    titleLabel.font = [UIFont boldSystemFontOfSize:18];
    self.navigationItem.titleView = titleLabel;
    self.navigationController.navigationBarHidden = NO;
    
    //重定义返回键
    UIButton *back = [UIButton buttonWithType:UIButtonTypeCustom];
    back.frame = CGRectMake(0, 0, 22, 22);
    [back setImage:[UIImage imageNamed:@"iconfont-fanhui-white"] forState:UIControlStateNormal];
    [back addTarget:self action:@selector(backTpMainView) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *backBar = [[UIBarButtonItem alloc] initWithCustomView:back];
    self.navigationItem.leftBarButtonItem = backBar;
    
    //创建scrollView
    self.bgContainerView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight - 48)];
    self.bgContainerView.backgroundColor = backgroundMainColor;
    self.bgContainerView.contentSize = CGSizeMake(self.view.frame.size.width, kScreenHeight * 1.1);
    [self.view addSubview:self.bgContainerView];
    

    //----网络请求
    [self NetworkRequests];
    
    //---------


}

#pragma mark 视图创建
- (void) setupView {
    // >>>>>>>>>>>>>>>>>>>>>>>>> demo轮播图1 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    
    
    //背景图片
    UIView *bgView = [[UIView alloc] initWithFrame:CGRectMake(10, 10, kScreenWidth - 20, kHightOfImageView)];
    bgView.layer.shadowOpacity = 1;
    bgView.layer.shadowColor = [UIColor grayColor].CGColor;
    bgView.layer.shadowRadius = 2.0;
    bgView.layer.cornerRadius = 2.0;
    bgView.layer.shadowOffset = CGSizeMake(0.0, 0.0);
    [self.bgContainerView addSubview:bgView];
    
    // 本地加载 --- 创建不带标题的图片轮播器
    //    SDCycleScrollView *cycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0, 0, kScreenWidth - 20, kHightOfImageView) imageNamesGroup:imageNames];
    //    cycleScrollView.layer.cornerRadius = 3;
    //    cycleScrollView.layer.masksToBounds = YES;
    //    cycleScrollView.infiniteLoop = YES;
    //    cycleScrollView.delegate = self;
    //    cycleScrollView.pageControlStyle = SDCycleScrollViewPageContolStyleAnimated;
    //    [bgView addSubview:cycleScrollView];
    //    self.automaticallyAdjustsScrollViewInsets = NO;
    //
    //         --- 轮播时间间隔，默认1.0秒，可自定义
    //    cycleScrollView.autoScrollTimeInterval = 2.0;
    
    
    // >>>>>>>>>>>>>>>>>>>>>>>>> demo轮播图2 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    
    // 网络加载 --- 创建带标题的图片轮播器
    SDCycleScrollView *cycleScrollView2 = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0, 0, kScreenWidth - 20, kHightOfImageView) delegate:self placeholderImage:[UIImage imageNamed:@"placeholder"]];
    cycleScrollView2.layer.cornerRadius = 3;
    cycleScrollView2.layer.masksToBounds = YES;
    cycleScrollView2.pageControlAliment = SDCycleScrollViewPageContolAlimentRight;
    cycleScrollView2.currentPageDotColor = [UIColor whiteColor]; // 自定义分页控件小圆标颜色
    [bgView addSubview:cycleScrollView2];
    
    //         --- 模拟加载延迟
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        cycleScrollView2.imageURLStringsGroup = self.imageURLStrMArray;
    });
    
    /*
     block监听点击方式
     
     cycleScrollView2.clickItemOperationBlock = ^(NSInteger index) {
     };
     
     */
    
    
    // >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    
    UIView *spaceViewThree = [[UIView alloc] initWithFrame:CGRectMake(0, kScreenHeight - 48, kScreenWidth, 0.5)];
    spaceViewThree.backgroundColor = lineColor;
    [self.view addSubview:spaceViewThree];
    
    
    
    //立即租用按钮
    self.immediateEffectBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    self.immediateEffectBtn.frame = CGRectMake(20, kScreenHeight - 41, kScreenWidth - 40, 34);
    self.immediateEffectBtn.layer.cornerRadius = 3;
    self.immediateEffectBtn.layer.masksToBounds = YES;
    self.immediateEffectBtn.backgroundColor = mainColor;
    [self.immediateEffectBtn setTitle:@"立即租用" forState:UIControlStateNormal];
    
    self.immediateEffectBtn.titleLabel.tintColor = [UIColor whiteColor];
    [self.immediateEffectBtn addTarget:self action:@selector(withImmediateEffectPush) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:self.immediateEffectBtn];
    
}

#pragma mark 个人信息详情
- (void) PersonalInformationDetails {
    
    UIView *myselfBgView = [[UIView alloc] initWithFrame:CGRectMake(10, 26 + kHightOfImageView, kScreenWidth - 20, 110)];
    myselfBgView.backgroundColor = [UIColor whiteColor];
    myselfBgView.layer.cornerRadius = 2;
    myselfBgView.layer.shadowRadius = 2.0;
    myselfBgView.layer.shadowColor = [UIColor grayColor].CGColor;
    myselfBgView.layer.shadowOpacity = 1;
    myselfBgView.layer.shadowOffset = CGSizeMake(0.0, 0.0);
    [self.bgContainerView addSubview:myselfBgView];
    
    //姓名标签
    self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, 50, 16)];
    self.nameLabel.text = self.member_str;
    self.nameLabel.textColor = [UIColor colorWithRed:51 / 255.0 green:51 / 255.0 blue:51 / 255.0 alpha:1];
    self.nameLabel.textAlignment = NSTextAlignmentLeft;
    self.nameLabel.font = [UIFont systemFontOfSize:15];
    [myselfBgView addSubview:self.nameLabel];
    
    //租金标签
    self.rentalExpensesLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 45, 50, 16)];
    self.rentalExpensesLabel.text = @"租金:";
    self.rentalExpensesLabel.textColor = [UIColor colorWithRed:51 / 255.0 green:51 / 255.0 blue:51 / 255.0 alpha:1];
    self.rentalExpensesLabel.textAlignment = NSTextAlignmentLeft;
    self.rentalExpensesLabel.font = [UIFont systemFontOfSize:15];
    [myselfBgView addSubview:self.rentalExpensesLabel];
    
    //交车地点标签
    self.addressLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 80, 75, 16)];
    self.addressLabel.text = @"交车地点:";
    self.addressLabel.textColor = [UIColor colorWithRed:51 / 255.0 green:51 / 255.0 blue:51 / 255.0 alpha:1];
    self.addressLabel.textAlignment = NSTextAlignmentLeft;
    self.addressLabel.font = [UIFont systemFontOfSize:15];
    [myselfBgView addSubview:self.addressLabel];
    
    //租金显示
    self.rentalExpensesShowLabel = [[UILabel alloc] initWithFrame:CGRectMake(90, 45, 70, 16)];
    self.rentalExpensesShowLabel.text = self.rent_member_money;
    self.rentalExpensesShowLabel.textColor = mainColor;
    self.rentalExpensesShowLabel.textAlignment = NSTextAlignmentRight;
    self.rentalExpensesShowLabel.font = [UIFont systemFontOfSize:15];
    [myselfBgView addSubview:self.rentalExpensesShowLabel];
    
    //单位显示
    self.unitLabel = [[UILabel alloc] initWithFrame:CGRectMake(160, 50, 35, 10)];
    self.unitLabel.text = @"元/天";
    self.unitLabel.textColor = [UIColor colorWithRed:85 / 255.0 green:85 / 255.0 blue:85 / 255.0 alpha:1];
    self.unitLabel.textAlignment = NSTextAlignmentLeft;
    self.unitLabel.font = [UIFont systemFontOfSize:10];
    [myselfBgView addSubview:self.unitLabel];
    
    //地点显示
    self.addressShowLabel = [[UILabel alloc] initWithFrame:CGRectMake(90, 78, 200, 25)];
    self.addressShowLabel.text = self.car_address;
    self.addressShowLabel.numberOfLines = 0;
    self.addressShowLabel.lineBreakMode = NSLineBreakByWordWrapping;
    self.addressShowLabel.font = [UIFont systemFontOfSize:10];
    self.addressShowLabel.textColor = [UIColor colorWithRed:85 / 255.0 green:85 / 255.0 blue:85 / 255.0 alpha:1];
    self.addressShowLabel.textAlignment = NSTextAlignmentLeft;
    [myselfBgView addSubview:self.addressShowLabel];
    
}

//==================================    网络请求   ===============================
#pragma mark 网络请求
- (void) NetworkRequests{
    
    self.imageURLStrMArray = [NSMutableArray array];
    self.vehicleBrand = [NSMutableArray array];
    self.vehicleBasic = [NSMutableArray array];
    
    //初始化进度框，置于当前的View当中
    MBProgressHUD *HUD = [[MBProgressHUD alloc] initWithView:self.view];
    [self.view addSubview:HUD];
    HUD.label.text = @"正在加载";
    [HUD showAnimated:YES];//HUD开始
    
    
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    //申明返回的结果是json类型
    manager.responseSerializer = [AFJSONResponseSerializer serializer];
    //申明请求的数据是json类型
    manager.requestSerializer = [AFHTTPRequestSerializer serializer];
    //如果报接受类型不一致请替换一致text/html或别的
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"];
    
    //传入的参数
    NSDictionary *para = @{
                           @"type" : @"1",
                           @"id" : self.carIDStr,
                           };
    //你的接口地址
    NSString *url = [NSString stringWithFormat:@"%@%@", kRealmName,kNetworkInterfaceCarDetail];
    //发送请求
    [manager POST:url parameters:para success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        [HUD hideAnimated:YES];
        
        NSDictionary *dic = responseObject;
        
        self.status = dic[@"status"];
        
        self.msg = dic[@"msg"];
        
        NSDictionary *info = dic[@"info"];
        
        //车辆id
        self.idNew = info[@"id"];

        //车牌
        self.place_str = info[@"place_str"];

        //用户名字
        self.member_str = info[@"member_str"];

        //租金
        self.rent_member_money = info[@"rent_member_money"];
        
        //交车地点
        self.car_address = info[@"car_address"];

        //轮播图片
        NSString *left_img_small = info[@"left_img_small"];
        
        NSString *urlStr = [NSString stringWithFormat:@"%@%@", kRealmNameImage, left_img_small];
        
        NSString *firstImageStr = urlStr;
        
        [self.imageURLStrMArray addObject:firstImageStr];
        
        NSArray *imageArray = info[@"car_other_img"];
        
        self.anyImage = imageArray.count;
        int i;
        
        for (i = 0; i < self.anyImage; i++) {
            
            NSString *str = [NSString stringWithFormat:@"%@%@", kRealmNameImage, imageArray[i]];
            
            [self.imageURLStrMArray addObject:str];
            
        }
        
        //自适应布局
        //1.品牌信息
        self.brand_str = info[@"brand_str"];
        self.model_str = info[@"model_str"];
        self.speed_box = info[@"speed_box"];
        
        [self.vehicleBrand addObject:self.brand_str];
        [self.vehicleBrand addObject:self.model_str];
        [self.vehicleBrand addObject:self.speed_box];
        
        
        self.vehicleBrandInformationArray = self.vehicleBrand;//品牌信息数组
        
        
        //2.基本信息
        self.style_str = info[@"style_str"];//型号
        self.displacement_str = info[@"displacement_str"];//排量
        self.oil_str = info[@"oil_str"];//汽油
        self.number_people_str = info[@"number_people_str"];//座位数
        self.colour_str = info[@"colour_str"];//黑色        
        
        //车辆基本信息
        [self.vehicleBasic addObject:self.style_str];
        [self.vehicleBasic addObject:self.displacement_str];
        [self.vehicleBasic addObject:self.oil_str];
        [self.vehicleBasic addObject:self.number_people_str];
        [self.vehicleBasic addObject:self.colour_str];
        self.vehicleBasicInformationArray = self.vehicleBasic;//车辆基本信息数组
                
        //3.配置信息
        self.conf_id_arr = info[@"conf_id_arr"];
 
        //
        [self setupView];
        
        //加载个人信息详情视图
        [self PersonalInformationDetails];
        
        //加载车辆详情信息视图
        [self VehicleDetailsInformation];
        
        //违章押金
        self.pledge_disobey_money = info[@"pledge_disobey_money"];
        
        //订单押金
        self.pledge_order_money = info[@"pledge_order_money"];
        
        //租车押金
        self.car_pledge_money = info[@"car_pledge_money"];
        
        //保险单价
        self.insurance_unit_money = info[@"insurance_unit_money"];
        
        //返回值分析
        [self resultAnalysis];
        
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        //初始化提示框；
        UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"没有网络" preferredStyle:  UIAlertControllerStyleAlert];
        
        [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
            //点击按钮的响应事件；
        }]];
        
        //弹出提示框；
        [self presentViewController:alert animated:true completion:nil];
        
        
    }];
    
}
//---------------------------此处以上-----------------------------------------



#pragma mark 车辆详情信息
- (void) VehicleDetailsInformation{
    
    //车辆信息背景视图
    UIView *carMessagesBgView = [[UIView alloc] initWithFrame:CGRectMake(10, kHightOfImageView + 146, kScreenWidth - 20, 196)];
    carMessagesBgView.layer.cornerRadius = 2;
    carMessagesBgView.layer.shadowOffset = CGSizeMake(0.0, 0.0);
    carMessagesBgView.layer.shadowRadius = 2;
    carMessagesBgView.layer.shadowColor = [UIColor grayColor].CGColor;
    carMessagesBgView.layer.shadowOpacity = 1;
    carMessagesBgView.backgroundColor = [UIColor whiteColor];
    [self.bgContainerView addSubview:carMessagesBgView];
    
    
    //车辆信息图标
    self.carMessagesImage = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 21, 14)];
    self.carMessagesImage.image = [UIImage imageNamed:@"iconfont-car"];
    [carMessagesBgView addSubview:self.carMessagesImage];
    
    //车辆信息标签
    self.carMessagesLabel = [[UILabel alloc] initWithFrame:CGRectMake(40, 10, 60, 14)];
    self.carMessagesLabel.text = @"车辆信息";
    self.carMessagesLabel.textColor = mainColor;
    self.carMessagesLabel.font = [UIFont systemFontOfSize:15];
    [carMessagesBgView addSubview:self.carMessagesLabel];
    
    //牌照
    self.licensePlateLabel = [[UILabel alloc] initWithFrame:CGRectMake(110, 13, 70, 12)];
    self.licensePlateLabel.text = self.place_str;
    self.licensePlateLabel.font = [UIFont systemFontOfSize:12];
    self.licensePlateLabel.textColor = [UIColor colorWithRed:85 / 255.0 green:85 / 255.0 blue:85 / 255.0 alpha:1];
    self.licensePlateLabel.textAlignment = NSTextAlignmentLeft;
    [carMessagesBgView addSubview:self.licensePlateLabel];
    
    //分隔线1
    UIView *spaceViewOne = [[UIView alloc] initWithFrame:CGRectMake(0, 32, kScreenWidth - 20, 0.5)];
    spaceViewOne.backgroundColor = lineColor;
    [carMessagesBgView addSubview:spaceViewOne];
    
    self.automaticallyAdjustsScrollViewInsets = NO;
    
    //1.车辆品牌信息
    UIView *carNameView = [[UIView alloc] initWithFrame:CGRectMake(0, 42, kScreenWidth - 20, 31)];
    [carMessagesBgView addSubview:carNameView];
    
    GBTagListView *carNameList =[[GBTagListView alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth - 20, 0)];
    [carNameList setTagWithTagArray:self.vehicleBrandInformationArray];
    [carNameView addSubview:carNameList];

    
    //2.车辆基本信息
    UIView *carBasicView = [[UIView alloc] initWithFrame:CGRectMake(0, 77, kScreenWidth - 20, 31)];
    carBasicView.layer.masksToBounds = YES;
    [carMessagesBgView addSubview:carBasicView];

    CarBasicView *carBasicList =[[CarBasicView alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth - 20, 0)];
    [carBasicList setTagWithTagArray:self.vehicleBasicInformationArray];
    [carBasicView addSubview:carBasicList];

    //分隔线2
    UIView *spaceViewTwo = [[UIView alloc] initWithFrame:CGRectMake(5, 114, kScreenWidth - 30, 0.5)];
    spaceViewTwo.backgroundColor = lineColor;
    [carMessagesBgView addSubview:spaceViewTwo];
    
    //配置信息标题的显示
    UIView *configurationInformationView = [[UIView alloc] initWithFrame:CGRectMake(0, 125, kScreenWidth - 20, 70)];
    [carMessagesBgView addSubview:configurationInformationView];
    
    CarConfigurationInformationView *configurationInformationList =[[CarConfigurationInformationView alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth - 20, 0)];
    [configurationInformationList setTagWithTagArray:self.conf_id_arr];
    [configurationInformationView addSubview:configurationInformationList];


    

}

#pragma mark  立即租用跳转
- (void) withImmediateEffectPush{

    Userinfo *user = [Userinfo shareInstance];
    
    if (user.isLogin == NO) {
        
        [self enterLoginView];
        
    } else {
        
        [self enterPlaceAnOrderVC];
        
    }

}

//跳转到登陆界面方法
- (void)enterLoginView {
    
    LoginViewController *loginVC = [[LoginViewController alloc] init];

    loginVC.successBlock = ^(){
        
        [self enterPlaceAnOrderVC];
        
    };
    
    [self.navigationController pushViewController:loginVC animated:nil];
}

//跳转到订单页面
- (void) enterPlaceAnOrderVC {
    
    PlaceAnOrderController *placeAnOrderVC = [[PlaceAnOrderController alloc] init];
    
    placeAnOrderVC.checkOutCarTimeStr = self.checkOutCarTimeStr;
    
    placeAnOrderVC.giveBackCarTimeStr = self.giveBackCarTimeStr;
    
    placeAnOrderVC.car_id = self.idNew;//车辆ID
    
    placeAnOrderVC.place_str = self.licensePlateLabel.text;//牌照
    
    placeAnOrderVC.brand_str = self.brand_str;
    
    placeAnOrderVC.model_str = self.model_str;
    
    placeAnOrderVC.speed_box = self.speed_box;
    
    placeAnOrderVC.rent_member_money = self.rentalExpensesShowLabel.text;//日租金
    
    placeAnOrderVC.pledge_disobey_money = self.pledge_disobey_money;//违章
    
    placeAnOrderVC.pledge_order_money = self.pledge_order_money;//订单
    
    placeAnOrderVC.car_pledge_money = self.car_pledge_money;//租车押金
    
    placeAnOrderVC.insurance_unit_money = self.insurance_unit_money;//保险押金
    
    [self.navigationController pushViewController:placeAnOrderVC animated:nil];
}

#pragma mark 返回主页
- (void) backTpMainView {
    
    [self.navigationController popViewControllerAnimated:nil];
    
}

#pragma mark 返回值分析
- (void) resultAnalysis {
    
    int status = [self.status intValue];
    
    switch (status) {
        case 99:{
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
                //点击按钮的响应事件；
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
        }
            
            break;
        case 98:{
            
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
                //点击按钮的响应事件；
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
        }
            break;
        case 97:
        {
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
                //点击按钮的响应事件；
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
        }
            
            break;
        case 96:
        {
            
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
                //点击按钮的响应事件；
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
        }
            
            break;
        case 1:
        {
            //初始化提示框；
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:self.msg preferredStyle:  UIAlertControllerStyleAlert];
            
            [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
                //点击按钮的响应事件；
            }]];
            
            //弹出提示框；
            [self presentViewController:alert animated:true completion:nil];
            
        }
            break;
            
        case 100:
        {
            
            
            
        }
            break;
            
        default:
            break;
    }
    
    
    
}



@end
